﻿
CREATE PROCEDURE [state_RePaginate]
	@ParentID int

AS
SET NOCOUNT ON

DECLARE @POSs TABLE(Pos int identity,ID int)
INSERT INTO @POSs(ID)
SELECT ID FROM t_State WHERE ParentID = @ParentID ORDER BY Pos

UPDATE t_State SET Pos = POSs.Pos
FROM t_State INNER JOIN @POSs POSs ON t_State.ID = POSs.ID



